package com.yazi.mxz.common.entity.beans;

import com.myframework.smhj.hibernate.Entity;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * StoreRegion entity. @author MyEclipse Persistence Tools
 */
@javax.persistence.Entity
@Table(name = "MXZ_STORE_REGION", schema = "MXZ")
public class StoreRegion extends Entity implements java.io.Serializable {

	// Fields

	private StoreRegionId id;
	private Region region;
	private Store store;
	private String regionPath;

	// Constructors

	/** default constructor */
	public StoreRegion() {
	}

	/** full constructor */
	public StoreRegion(StoreRegionId id, Region region, Store store,
			String regionPath) {
		this.id = id;
		this.region = region;
		this.store = store;
		this.regionPath = regionPath;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "storeId", column = @Column(name = "STORE_ID", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "regionId", column = @Column(name = "REGION_ID", nullable = false, precision = 15, scale = 0)) })
	public StoreRegionId getId() {
		return this.id;
	}

	public void setId(StoreRegionId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "REGION_ID", nullable = false, insertable = false, updatable = false)
	public Region getRegion() {
		return this.region;
	}

	public void setRegion(Region region) {
		this.region = region;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "STORE_ID", nullable = false, insertable = false, updatable = false)
	public Store getStore() {
		return this.store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@Column(name = "REGION_PATH", nullable = false, length = 100)
	public String getRegionPath() {
		return this.regionPath;
	}

	public void setRegionPath(String regionPath) {
		this.regionPath = regionPath;
	}

}